package com.zzl.finance.data.controller;

import com.zzl.apidoc.annotation.ApidocController;
import com.zzl.apidoc.annotation.ApidocOperation;
import com.zzl.apidoc.annotation.ApidocParam;
import com.zzl.finance.data.entity.BankInformationEntity;
import com.zzl.finance.data.service.BankInformationService;
import com.zzl.general.common.apidoc.annotation.ApidocResultKeyValR;
import com.zzl.general.common.apidoc.annotation.ApidocReturnR;
import com.zzl.general.common.apidoc.constants.ResultTypeInR;
import com.zzl.general.common.ctrl.WebBaseCtrl;
import com.zzl.general.common.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author sunpp
 * @date 2021-11-29 13:17:46
 */
@ApidocController("5银行账户信息分行支行")
@RestController
@SuppressWarnings("javadoc")
@RequestMapping("data/bankInformation")
@Slf4j
public class BankInformationController extends WebBaseCtrl {

    @Autowired
    private BankInformationService bankInformationEntityService;

    /**
     * 信息
     */
    @GetMapping("/info/{bankName}")
    @ApidocOperation(description = "通过名称模糊搜索获取数据", operationId = "data/supplier/info/bankName")
    @ApidocReturnR(otherkv = {
            @ApidocResultKeyValR(resultType = ResultTypeInR.TYPE_ARRAY, key = "list", valueClass = BankInformationEntity.class)
    })
    public Result info(@ApidocParam(name = "bankName", required = true) @PathVariable("bankName") String bankName) {
        List<BankInformationEntity> list = bankInformationEntityService.listByBankName(bankName);
        return Result.ok().put("list", list);
    }

}
